<template>
	<view class="new_page">
		<view class="main">

			<view class="qr_code_wrap">
				<view class="">
					官方微信
				</view>
				<view class="qr_code">
					<image src="https://hetp.hephp.cn/static/images/wbs.jpg" mode="widthFix">
					</image>
				</view>
			</view>
			
			<view class="phone">
				联系我们：<text class="num" @click="callPhone">18642860190</text>
			</view>
			<view class="bc_btn">
				<button @click="savecode" class="b-bg btn-r">
					保存二维码
				</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {}
		},
		onLoad() {

		},
		methods: {
			callPhone() {
				uni.makePhoneCall({
					phoneNumber: '18642860190', //仅为示例，并非真实的电话号码
					success: function() {
						console.log("拨打电话成功！")
					},
					fail: function() {
						console.log("拨打电话失败！")
					}
				})
			},
			savecode() {
				this.queryAuthorize('scope.writePhotosAlbum', () => {
					uni.getImageInfo({
						src: 'https://hetp.hephp.cn/static/images/wbs.jpg',
						success(data) {
							console.log(data)
							uni.saveImageToPhotosAlbum({
								filePath: data.path,
								success: res => {
									uni.showToast({
										title: '保存成功',
										icon: 'success'
									})
								},
								fail: err => {
									console.log(err);

								}
							})
						},
						fail(res) {
							console.log(res)
						}
					})

				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	.main {
		width: 90%;
		margin: auto;
		padding-top: 50rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		.qr_code_wrap {
			width: 100%;
			background-color: #fff;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			padding: 50rpx 0 100rpx;
			border-radius: 10rpx;
		}
		.qr_code {
			width: 60%;
			margin-top: 32rpx;
		}

		.bc_btn {
			width: 40%;
			margin-top: 60rpx;
		}

		.phone {
			width: 100%;
			background-color: #fff;
			margin-top: 30rpx;
			border-radius: 10rpx;
			padding: 50rpx;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			justify-content: center;

			.num {
				text-decoration: underline;
			}
		}
	}
</style>